﻿CREATE TABLE [dbo].[ClinRecipeOrder]
(
	[Id] INT NOT NULL PRIMARY KEY IDENTITY,
	[BkMemberId] BIGINT NULL, 
    [WxUserId] BIGINT NULL, 
	[OrderNo] NVARCHAR(50) NULL,
    [CardNo] NVARCHAR(50) NULL, 
	[PatName]  NVARCHAR(50) NULL,
	[RecipeIds] NVARCHAR(MAX) NULL,
	[IsSb] NVARCHAR(50) NULL,
	[PayAmt]  NVARCHAR(50) NULL,
	[BankCardNo] NVARCHAR(50) NULL,
	[PayDate] DATETIME NULL,
	[CashierId] NVARCHAR(50) NULL,
	[MachineId] NVARCHAR(50) NULL,
	[HosPayId] NVARCHAR(50) NULL,
	[InvoiceNo] NVARCHAR(500) NULL, 
	[TotalAmt]  NVARCHAR(50) NULL,
	[SelfAmt] NVARCHAR(50) NULL,
	[SbPayAmt] NVARCHAR(50) NULL,
    [ResultMark] NVARCHAR(MAX) NULL,
	[Remark] NVARCHAR(MAX) NULL,
	[OrderStatus] INT NOT NULL, 
    [PayState] NVARCHAR(50) NULL, 
    [CreateTime] DATETIME NULL, 
    [PayTime] DATETIME NULL, 
    [FetchTime] DATETIME NULL, 
    [RefundTime] DATETIME NULL, 
    [NextCheckTime] DATETIME NULL, 
    [OrderStatusOnSetCheck] INT NULL, 
    [CheckReserved] NVARCHAR(50) NULL, 
    [WxTransactionId] NVARCHAR(50) NULL, 
    [WxRefundId] NVARCHAR(50) NULL, 
    
)


GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'主键，自增长',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'Id'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'BkMember.Id',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'BkMemberId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'WxUser.Id',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'WxUserId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'订单号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'OrderNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'诊疗卡号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'CardNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'病人名称',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'PatName'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'本次缴费的处方的唯一编号序列,多张处方时用逗号分隔',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'RecipeIds'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'是否医保，1为医保  0为自费',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'IsSb'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'付款金额（自费总额）',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'PayAmt'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'银行卡号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'BankCardNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'付款时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'PayDate'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'虚拟收费员工号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'CashierId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'虚拟收费员工号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'MachineId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'缴费成功后，返回：缴费流水号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'HosPayId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'缴费成功后，返回：发票号',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'InvoiceNo'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'缴费成功后，返回：处方处理备注',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'ResultMark'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'缴费成功后，返回：总金额',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'TotalAmt'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'缴费成功后，返回：自费金额',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'SelfAmt'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'缴费成功后，返回：社保报销金额',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'SbPayAmt'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'备注',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'Remark'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'单据状态：0未支付 1支付中 2支付成功 3支付失败 4退款中 5退款成功 6退款失败 7缴费中 8缴费成功 9缴费失败',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'OrderStatus'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'支付状态:0-未付款,1-已付款,2-退款中,3-已退款',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'PayState'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'订单创建时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'CreateTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'支付成功时间，支付成功后微信返回',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'PayTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'缴费成功时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'FetchTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'退款成功时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'RefundTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'系统下次检查时间',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'NextCheckTime'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'设置系统下次检查时间时的订单状态',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'OrderStatusOnSetCheck'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'系统检查预留字段',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'CheckReserved'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'微信支付交易号，支付成功后微信返回',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'WxTransactionId'
GO
EXEC sp_addextendedproperty @name = N'MS_Description',
    @value = N'微信支付退款单号，退款成功后微信返回',
    @level0type = N'SCHEMA',
    @level0name = N'dbo',
    @level1type = N'TABLE',
    @level1name = N'ClinRecipeOrder',
    @level2type = N'COLUMN',
    @level2name = N'WxRefundId'